/**
 * 合并静态路由和动态路由
 */

// 导入静态路由
import { constantRoutes } from '@/router'

export default {
  namespaced: true, // 开启命名空间
  state: () => ({
    routes: constantRoutes// 默认的静态路由
  }),
  mutations: {
    // 将静态路由和动态路由合并
    setRoutes(state, asyncRoutes) {
      // 将静态路由和动态路由合并,赋值给 routes
      state.routes = [...constantRoutes, ...asyncRoutes]
    }
  }
}
